/**
 * TabBar Component Style for tingle
 * @author zhouwenjie
 * 
 * Copyright 2014-2016, Tingle Team.
 * All rights reserved.
 */
$tabsBarZIndex = 80;
$tabsBarHeight = 48px;
$tabsBarItemIconSize = 25px;
$tabsBarItemLabelFontSize = 10px;
$tabsBarItemLineHeight = 12px;
$tabsBarItemBorderRadius = 0;
$tabsBarBgColor = white;
$tabsBarItemBaseColor = $normal-alpha-4;
$tabsBarItemActiveColor = $brand-primary;
$tabsBarItemMoreCenterIcon = $brand-primary;
$tabsBarBadgePointSize = 10px;
$tabsBarBorderTopColor = $normal-alpha-7;

.{$prefix}-tabs-bar {
  display: block;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: $tabsBarZIndex;
  background: $tabsBarBgColor;
  height: $tabsBarHeight;
  fix-safe-area(height, $tabsBarHeight);
  hairline('border-top', $tabsBarBorderTopColor);
}

// 这一行只是演示 按需删除
.{$prefix}-tabs-bar-contents {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: $tabsBarHeight;
}

.{$prefix}-tabs-bar-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: scroll;
  -webkit-overflow-scrolling: touch;
  display: none;

  &.active {
    display: block;
  }
}

.{$prefix}-tabs-bar-item {
  position: relative;
  text-align: center;
  color: $tabsBarItemBaseColor;

  &.active {
    color: $tabsBarItemActiveColor;

    .{$prefix}-tabs-bar-item-icon svg {
      fill: $tabsBarItemActiveColor;
    }
  }

  .t-badge .badge-inner {
    top: 5px;
  }
}

.{$prefix}-tabs-bar-item-label {
  display: block;
  font-size: $tabsBarItemLabelFontSize;
  -webkit-text-size-adjust: none;
  line-height: $tabsBarItemLineHeight;
}

.{$prefix}-tabs-bar-item-more {
  color: #fff;

  .{$prefix}-tabs-bar-item-label {
    margin-top: 8px;
  }

  .t-badge .badge-inner {
    right: 10px;
  }
}

.{$prefix}-tabs-bar-item-img-icon {
  display: block;
  margin: 0 auto;
  width: $tabsBarItemIconSize;
  height: $tabsBarItemIconSize;
}

.{$prefix}-tabs-bar-item-icon {
  display: inline-block;
  position: relative;

  &.{$prefix}-tabs-bar-item-icon-more-center {
    width: 48px;
    height: 48px;
    // background-color: $tabsBarItemMoreCenterIcon;
    border-radius: 50%;
    line-height: 48px;
    position: relative;
    top: -5px;
    transition: all 0.3s ease-out;
    z-index: 1001;

    .t-icon {
      display: inline-block;
      vertical-align: middle;

      svg {
        fill: white;
      }
    }

    &__more-visible {
      transform: rotate(45deg);
    }
  }
}

.{$prefix}-tabs-bar-item-more-icon {
  width: 64px;
  height: 64px;
  background-color: #fff;
  border-radius: 50%;
  line-height: 64px;
  color: #fff;

  .t-icon {
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
  }
}

.{$prefix}-tabs-bar-item-tingle-icon svg {
  fill: $tabsBarItemBaseColor;
}

.{$prefix}-tabs-bar-item-center-tingle-icon {
  background-color: $brand-primary;
  border-radius: 25px;

  svg {
    display: block;
    fill: $tabsBarItemBaseColor;
  }
}

.{$prefix}-tabs-bar-item-center {
  background: #f9f9f9;
  box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.2);
  width: 110px;
  box-sizing: border-box;
  height: 110px;
  border-radius: 65px;
  position: absolute;
  left: 0px;
  bottom: -33px;
  z-index: 2;
}

.{$prefix}-tabs-bar-item-center-container {
  z-index: 2;
  background-color: #f9f9f9;
  position: relative;
  width: 120px;
  height: 50px;
  left: -3px;
}

.{$prefix}-tabs-bar-item-more-container {
  position: fixed;
  width: 170px;
  text-align: center;

  &-inner {
    padding: 38px 10px 80px;
    fix-safe-area(padding-bottom, 80px);
    height: 100%;
    background: $dark-alpha-6;
  }
}

.{$prefix}-tabs-bar-item-more-close-btn {
  text-align: center;
  margin-top: 25px;
  display: inline-block;
  background-color: #f37327;
  border-radius: 25px;

  svg {
    fill: #5B5B5B;
    display: block;
  }
}

.{$prefix}-tabs-bar-dark {
  background: $function-dark;

  .{$prefix}-tabs-bar-item {
    color: $white-alpha-3;

    .{$prefix}-tabs-bar-item-center-tingle-icon svg {
      fill: $white-alpha-3;
    }

    &.active {
      color: $brand-primary;

      .{$prefix}-tabs-bar-item-center-tingle-icon svg {
        fill: $brand-primary;
      }
    }
  }
}

.{$prefix}-tabs-bar-item {
  &-fade-enter,
  &-fade-appear {
    opacity: 0;
    animation-duration: 0.3s;
    animation-fill-mode: both;
    animation-timing-function: $transition-ease;

    .{$prefix}-badge {
      transform: translate(0, 24px);
      animation-duration: 0.3s;
      animation-fill-mode: both;
      animation-timing-function: $transition-ease;
    }
  }

  &-fade-enter-active,
  &-fade-appear-active {
    animation-name: tabBarItemFadeIn;

    .{$prefix}-badge {
      animation-name: tabBarItemSlideUp;
    }
  }

  &-fade-leave {
    animation-duration: 0.3s;
    animation-fill-mode: both;
    animation-timing-function: $transition-ease;

    .{$prefix}-badge {
      animation-duration: 0.3s;
      animation-fill-mode: both;
      animation-timing-function: $transition-ease;
    }
  }

  &-fade-leave-active {
    animation-name: tabBarItemFadeOut;

    .{$prefix}-badge {
      animation-name: tabBarItemSlideDown;
    }
  }

  @keyframes tabBarItemFadeIn {
    0% {
      opacity: 0;
    }

    100% {
      opacity: 1;
    }
  }

  @keyframes tabBarItemFadeOut {
    0% {
      opacity: 1;
    }

    100% {
      opacity: 0;
    }
  }

  @keyframes tabBarItemSlideUp {
    0% {
      transform: translate(0, 24px);
    }

    100% {
      transform: translate(0, 0);
    }
  }

  @keyframes tabBarItemSlideDown {
    0% {
      transform: translate(0, 0);
    }

    100% {
      transform: translate(0, 24px);
    }
  }
}
